package com.hsjk.szwj.module.train.api;

import com.hsjk.szwj.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hsjk.szwj.framework.tenant.core.aop.TenantIgnore;
import com.hsjk.szwj.module.train.api.dto.DivisionReceiverDTO;
import com.hsjk.szwj.module.train.convert.SkuDivisionConvert;
import com.hsjk.szwj.module.train.dal.dataobject.product.SkuDivisionMappingDO;
import com.hsjk.szwj.module.train.dal.mysql.product.ISkuDivisionMappingMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/12/05 22:13
 **/
@Service
public class SkuDivisionApiImpl implements ISkuDivisionApi {
    @Resource
    private ISkuDivisionMappingMapper skuDivisionMappingMapper;

    @Override
    @TenantIgnore
    public List<DivisionReceiverDTO> getSkuDivisionListBySkuId(Long skuId) {
        List<SkuDivisionMappingDO> skuDivisionMappingDOS = skuDivisionMappingMapper.selectList(new LambdaQueryWrapperX<SkuDivisionMappingDO>()
                .eq(SkuDivisionMappingDO::getSkuId, skuId));
        return SkuDivisionConvert.INSTANCE.convertDivisionReceiverList(skuDivisionMappingDOS);
    }
}
